package com.bigshen.spring.demo.action;

import com.bigshen.spring.demo.service.IQueryService;
import com.bigshen.spring.framework.annonation.Autowired;
import com.bigshen.spring.framework.annonation.Controller;
import com.bigshen.spring.framework.annonation.RequestMapping;
import com.bigshen.spring.framework.annonation.RequestParam;
import com.bigshen.spring.framework.webmvc.servlet.ModelAndView;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author eddy.shen
 * @Date 2020/4/18 11:12
 **/
@Controller
@RequestMapping("/")
public class PageAction {

    @Autowired
    IQueryService queryService;

    @RequestMapping("/first.html")
    public ModelAndView query(@RequestParam("teacher") String teacher){
        String result = queryService.query(teacher);
        Map<String,Object> model = new HashMap<String,Object>();
        model.put("teacher", teacher);
        model.put("data", result);
        model.put("token", "123456");
        return new ModelAndView("first.html",model);
    }



}
